/*
 * @Author: 刘昌宏
 * @Date: 2025-07-24 16:36:13
 * @LastEditors: 刘昌宏
 * @LastEditTime: 2025-08-01 09:22:01
 * @Description: 
 */
import request from '@/utils/request'

/**
 * 获得部署分页
 * @param {*} query 
 * @returns 
 */
export function piplineDeployPage(query) {
  return request({
    url: '/pi/pipline/deploy/page',
    method: 'get',
    headers: {
      'Content-type': 'application/x-www-form-urlencoded'
    },
    params: query,
  })
}

/**
 * 创建部署
 * @param {*} data 
 * @returns 
 */
export function piplineDeployCreate(data) {
  return request({
    url: '/pi/pipline/deploy/create',
    method: 'POST',
    data: data
  })
}

/**
 * 更新部署
 * @param {*} data 
 * @returns 
 */
export function piplineDeployUpdata(data) {
  return request({
    url: '/pi/pipline/deploy/update',
    method: 'put',
    data
  })
}

/**
 * 获得部署
 * @param {*} query 
 * @returns 
 */
export function piplineDeployGet(query) {
  return request({
    url: '/pi/pipline/deploy/get',
    method: 'get',
    headers: {
      'Content-type': 'application/x-www-form-urlencoded'
    },
    params: query,
  })
}

/**
 * 删除部署
 * @param {*} query 
 * @returns 
 */
export function piplineDeleteModel(id) {
  return request({
    url: '/pi/pipline/deploy/delete?id=' + id,
    method: 'DELETE'
  })
}

/**
 * 获得流水线阶段任务
 * @param {*} data 
 * @returns 
 */
export function piplineTaskGetStageTask(deployType) {
  return request({
    url: `/pi/pipline/task/getStageTask/${deployType}`,
    method: 'POST',
    headers: {
      'Content-type': 'application/x-www-form-urlencoded'
    },
  })
}

/**
 * 创建流水线任务
 * @param {*} data 
 * @returns 
 */
export function piplineTaskCreate(data) {
  return request({
    url: '/pi/pipline/task/create',
    method: 'POST',
    data: data
  })
}

/**
 * 获得部署执行
 * @param {*} data 
 * @returns 
 */
export function piplineGetExecWithRunDetail(id) {
  return request({
    url: '/pi/pipline/exec/getExecWithRunDetail?id=' + id,
    method: 'POST',
  })
}

/**
 * 创建部署执行
 * @param {*} data 
 * @returns 
 */
export function piplineExecCreate(data) {
  return request({
    url: '/pi/pipline/exec/create',
    method: 'POST',
    data,
  })
}
/**
 * 获得部署执行分页
 * @param {*} query 
 * @returns 
 */
export function piplineExecPage(query) {
  return request({
    url: '/pi/pipline/exec/page',
    method: 'get',
    headers: {
      'Content-type': 'application/x-www-form-urlencoded'
    },
    params: query,
  })
}
/**
 * 根据字典类型查询字典数据信息
 * @param {*} query 
 * @returns 
 */
export function systemDictDataType(query) {
  return request({
    url: '/system/dict-data/type',
    method: 'get',
    headers: {
      'Content-type': 'application/x-www-form-urlencoded',
      URL_PREFIX: '/app-api/',
      noToken: true

    },
    params: query,
  })
}
